/*-
 * <<
 * Moonbox
 * ==
 * Copyright (C) 2016 - 2019 EDP
 * ==
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * >>
 */

package moonbox.catalyst.jdbc

import java.sql.{Blob, CallableStatement, Clob, DatabaseMetaData, NClob, PreparedStatement, SQLWarning, SQLXML, Savepoint, Statement, Struct}
import java.util.Properties
import java.util.concurrent.Executor
import java.{sql, util}

class CatalystConnection(url: String, props: Properties) extends java.sql.Connection{
  override def commit(): Unit = {}

  override def getHoldability: Int = 0

  override def setCatalog(catalog: String): Unit = {}

  override def setHoldability(holdability: Int): Unit = {}

  override def prepareStatement(sql: String): PreparedStatement = null

  override def prepareStatement(sql: String, resultSetType: Int, resultSetConcurrency: Int): PreparedStatement = null

  override def prepareStatement(sql: String, resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): PreparedStatement = null

  override def prepareStatement(sql: String, autoGeneratedKeys: Int): PreparedStatement = null

  override def prepareStatement(sql: String, columnIndexes: Array[Int]): PreparedStatement = null

  override def prepareStatement(sql: String, columnNames: Array[String]): PreparedStatement = null

  override def createClob(): Clob = null

  override def setSchema(schema: String): Unit = {}

  override def setClientInfo(name: String, value: String): Unit = {}

  override def setClientInfo(properties: Properties): Unit = {}

  override def createSQLXML(): SQLXML = null

  override def getCatalog: String = null

  override def createBlob(): Blob = null

  override def createStatement(): Statement = new CatalystStatement(url, props)

  override def createStatement(resultSetType: Int, resultSetConcurrency: Int): Statement = null

  override def createStatement(resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): Statement = null

  override def abort(executor: Executor): Unit = {}

  override def setAutoCommit(autoCommit: Boolean): Unit = {}

  override def getMetaData: DatabaseMetaData = null

  override def setReadOnly(readOnly: Boolean): Unit = {}

  override def prepareCall(sql: String): CallableStatement = null

  override def prepareCall(sql: String, resultSetType: Int, resultSetConcurrency: Int): CallableStatement = null

  override def prepareCall(sql: String, resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): CallableStatement = null

  override def setTransactionIsolation(level: Int): Unit = {}

  override def getWarnings: SQLWarning = null

  override def releaseSavepoint(savepoint: Savepoint): Unit = {}

  override def nativeSQL(sql: String): String = null

  override def isReadOnly: Boolean = false

  override def createArrayOf(typeName: String, elements: Array[AnyRef]): sql.Array = null

  override def setSavepoint(): Savepoint = null

  override def setSavepoint(name: String): Savepoint = null

  override def close(): Unit = {}

  override def createNClob(): NClob = null

  override def rollback(): Unit = {}

  override def rollback(savepoint: Savepoint): Unit = {}

  override def setNetworkTimeout(executor: Executor, milliseconds: Int): Unit = {}

  override def setTypeMap(map: util.Map[String, Class[_]]): Unit = {}

  override def isValid(timeout: Int): Boolean = false

  override def getAutoCommit: Boolean = false

  override def clearWarnings(): Unit = {}

  override def getSchema: String = null

  override def getNetworkTimeout: Int = 0

  override def isClosed: Boolean = false

  override def getTransactionIsolation: Int = 0

  override def createStruct(typeName: String, attributes: Array[AnyRef]): Struct = null

  override def getClientInfo(name: String): String = null

  override def getClientInfo: Properties = null

  override def getTypeMap: util.Map[String, Class[_]] = null

  override def unwrap[T](iface: Class[T]): T = null.asInstanceOf[T]

  override def isWrapperFor(iface: Class[_]): Boolean = false
}
